#include "Camera.h"
#include <glm\gtc\matrix_transform.hpp>

void Camera::LookAt(float x,float y,float z)
{
	lookDirection = glm::vec3(x,y,z);
}

void Camera::LookAt(glm::vec3 dir)
{
	lookDirection = dir;
}

glm::mat4 Camera::GenerateViewMatrix()
{
	return glm::lookAt(GetPosition(),lookDirection,glm::vec3(0.0f,1.0f,0.0f));
}
glm::mat4 Camera::GenerateProjMatrix()
{
	return glm::perspective(fov,aspectRatio,nearPlaneDistance,farPlaneDistance);
}

void Camera::SetFOV(float fov)
{
	this->fov = fov;
}
float Camera::GetFOV()
{
	return fov;
}

Camera::Camera(std::string camName) : SingleControlPointObject()
{
	SetFOV(45.0f);
	LookAt(0.0f,0.0f,0.0f);
	SetAspectRatio(1.0f);
	SetNearPlaneDistance(1.0f);
	SetFarPlaneDistance(1000.0f);
	SetName(camName);
	
}

void Camera::SetAspectRatio(float aspect)
{
	aspectRatio = aspect;
}

float Camera::GetAspectRatio()
{
	return aspectRatio;
}

void Camera::SetNearPlaneDistance(float near)
{
	this->nearPlaneDistance = near;
}
float Camera::GetNearPlaneDistance()
{
	return nearPlaneDistance;
}

void Camera::SetFarPlaneDistance(float far)
{
	farPlaneDistance = far;
}

float Camera::GetFarPlaneDistance()
{
	return farPlaneDistance;
}

void Camera::SetName(std::string name)
{
	this->name = name;
}
std::string Camera::GetName()
{
	return name;
}